package com.redstar.interesting.main;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import com.redstar.interesting.main.hello.controller.Hello2Controller;
import com.redstar.interesting.main.hello.controller.Hello3Controller;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.ansi.AnsiOutput;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.SpringVersion;

/**
 * @author lihongxing
 */
@MapperScan("com.redstar.interesting.main.**.mapper")
@SpringBootApplication(
        exclude = {DruidDataSourceAutoConfigure.class},
        scanBasePackages = {
//                "com.tecdo.cpmsclient",
                "com.redstar.interesting.main"
        })
public class InterestingMainApplication {

    public static void main(String[] args) {
//        SpringApplication.run(InterestingMainApplication.class, args);


        AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
        SpringApplication application = new SpringApplicationBuilder(InterestingMainApplication.class)
                .main(SpringVersion.class)
                .bannerMode(Banner.Mode.CONSOLE).build(args);
        //禁止命令行添加属性到 Environment 中
        application.setAddCommandLineProperties(false);
        application.run(args);

//        SpringApplication application = new SpringApplication(InterestingMainApplication.class);
//        application.setBannerMode(Banner.Mode.OFF);
//        application.setAllowBeanDefinitionOverriding(true);
//        application.setLogStartupInfo(true);
//        application.run(args);


    }


    @Bean("/hello2")
    public Hello2Controller hello2Controller() {
        return new Hello2Controller();
    }

    @Bean("/hello3")
    public Hello3Controller hello3Controller() {
        return new Hello3Controller();
    }
}
